<template>
	<view class="bargain-more" v-if="showList && showList.length>0">
		<view class="mc-space-between mc-flex-vcenter color-white">
			<text class="mc-bold mc-f18">砍价免费拿</text>
			<form report-submit="true" @submit="setFormId">
				<button form-type="submit" hover-class="none" class="mc-flex-vcenter formId-btn" v-if="showList.length>1">
					<text class=" mc-f14 padding-right10" @tap="toMore">查看更多皮肤</text>
					<image src="../../../static/images/right-arrow.png" class="width24 height24" @tap="toMore"></image>
				</button>
			</form>
		</view>
		<view class="bargain-more-bd">
			<view class="bargain-more-item" v-for="(item,index) in showList" :key="item.id">
				<bargain-list-item :item="item"></bargain-list-item>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapGetters,
		mapActions
	} from 'vuex';
	import bargainListItem from '@/components/home/bargain-list-item/index.vue'
	export default {
		components: {
			bargainListItem
		},
		props: {
			info: {
				type: Object,
				default: {}
			},
		},
		data() {
			return {}
		},
		computed: {
			...mapGetters('draw',{list:'_bargainList'}),
			showList:function(){
				let list = (this.list || []).slice(0,3)
				return list
			}
		},
		methods: {
			...mapActions('common', ['tabCurrent2Up']),
			...mapActions('draw', ['bargainListLoad']),
			toMore(current) {
				this.tabCurrent2Up(1);
				uni.switchTab({
					url:'/pages/tabBar/draw/index'
				})
			},
			// ---------------------------------------
			// 保存二维码
			setFormId(e) {
				this.$store.dispatch('common/formIdListUp', {
					e: e,
					isSave: true
				})
			},
		},
		mounted() {
			this.bargainListLoad()
		}
	}
</script>

<style lang="scss" scoped>
	.bargain-more {
		position: relative;
		width: 100%;
		z-index: 9;
		overflow: hidden;
		
		.bargain-more-item{
			position: relative;
			padding: 24rpx 20rpx;
			background-color: white;
			border-radius: 10rpx;
			margin-top: 20rpx;
		}
	}
</style>